Skip to content

Opsx enable system parameters globally - #640

Merged
popescu-v merged 10 commits into
mainfrom
opsx-enable-system-parameters-globally
Nov 25, 2026
Merged

popescu-v merged 10 commits into
mainfrom
opsx-enable-system-parameters-globally

Conversation

@popescu-v

@popescu-v popescu-v commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

closes #622


TODO Before Asking for a Review

  • Rebase your branch to the latest version of main (or main-v10)
  • Make sure all CI workflows are green
  • When adding a public feature/fix: Update the Unreleased section of CHANGELOG.md (no date)
  • Self-Review: Review "Files Changed" tab and fix any problems you find
  • API Docs (only if there are changes in docstrings, markdown files or samples):
    • Check the docs build without warning: see the log of the API Docs workflow
    • Check that your changes render well in HTML: download the API Docs artifact and open index.html
    • If there are any problems it is faster to iterate by building locally the API Docs

@popescu-v
popescu-v requested a review from tramora November 5, 2026 18:31
@popescu-v
popescu-v removed the request for review from tramora November 6, 2026 12:18
@popescu-v
popescu-v force-pushed the opsx-enable-system-parameters-globally branch from 8638d98 to 48991e4 Compare November 9, 2026 15:09
lucaurelien and others added 9 commits November 25, 2026 16:44
Otherwise, before this commit, once a Core API call was done with
a max_cores set, this max_cores leaked into subsequent Core API calls,
because a new runner was created and, crucially, then set via set_runner
so that subsequent Core API calls use it.
Indeed, the lock is not needed, because the _CURRENT_ENVIRONMENT
dictionary is never mutated in-place. It is replaced atomically.
- test that changing default values set-up a local runner that inherits
  unchanged runner settings;
- test that the default system parameters are just stored for non-local
  (e.g. Docker) runners;
- test that the default system parameters are not committed if the
  runner creation fails for some reason.
If the current environment gets some of the KHIOPS_* system-parameter
environment variables set to empty values (which is possible via
external process, e.g. CI), then they are not set accordingly as
a default variable.
@popescu-v
popescu-v requested a review from tramora November 25, 2026 16:13
@popescu-v
popescu-v force-pushed the opsx-enable-system-parameters-globally branch from 4ff1404 to ebc6448 Compare November 25, 2026 16:41
return _khiops_runner


def get_runner():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One may wonder without reading the docstrings the difference between peek_runner and get_runner. As getters has usually no side-effect, the latter may be renamed from get_runner to get_or_create_runner (à la Django)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree, but this would entail the change of an existing (albeit internal) API, as opposed to a mere addition to the said API (which peek_runner does). However, this could be done in a different PR IMHO:

  • rename get_runner to get_or_create_runner;
  • rename peek_runner to get_runner.

Comment thread khiops/core/api.py
return runner


def _get_task_runner(max_cores):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth declaring a named parameter (max_cores=None) so that it is obvious that it is optional

@popescu-v popescu-v Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do that, but this "private" helper function is only called in a single place, and the None is for an input via system_settings.max_cores which would actually be None; it is not really a "default" value for this helper IMHO.

@tramora tramora left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor remarks you have already taken into account

@popescu-v
popescu-v merged commit e0eca7d into main Nov 25, 2026
9 checks passed
@popescu-v
popescu-v deleted the opsx-enable-system-parameters-globally branch November 25, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable System Parameters Globally

3 participants